20. Appendix C QSPI programming guide

20.1. General

This guide describes the methods and tools used for:

  • Programming QSPI flash
  • Debugging programs which execute from QSPI flash

After programming the QSPI, the image will execute by resetting or power cycling the board.

20.2. Prerequisites

Compile the following tools (sources and projects available on SmartSnippets™ DA1468x SDK):

cli_programmer:

Compile <sdk_root_directory>/utilities/cli_programmer project.

Linux: Use Debug_static build configuration in SmartSnippets™ Studio

Windows: Compile cli_programmer.sln using Visual studio OR use the binaries from SmartSnippets™ DA1468x SDK’s binaries folder

(cli_programmer.exe, libprogrammer.dll)

bin2image:

Compile <sdk_root_directory>/utilities/bin2image project.

Linux: Run make from project’s folder

Windows: Check README.win32 in project’s folder OR use the binary from SmartSnippets™ DA1468x SDK’s binaries folder (bin2image.exe)

uartboot.bin:

This is the intermediate bootloader that cli_programmer uses for communicating with the target.

The uartboot firmware will automatically detect the device variant. This means that the provided uartboot binary file does not have to be rebuilt if a different device variant of the DA1468x family is used.

Compile ./sdk/bsp/system/loaders/uartboot/ in SmartSnippets™ Studio using the release configuration

Note

cli_programmer uses uartboot.bin for communicating with the target.

Copying uartboot.bin to the folder of the cli_programmer binary will allow cli_programmer to automatically detect & use uartboot.bin.

Alternatively, the path to uartboot.bin can be provided to cli_programmer using -b commandline option.

Import scripts project into the eclipse workspace in use.

This is needed to starts the cli_programmer from within SmartSnippets™ Studio IDE

20.3. Compiling for execution from flash

SmartSnippets™ DA1468x SDK projects come with SmartSnippets™ Studio build configurations which compile for execution for FLASH (cached) or RAM.

Configuring a project for execution from FLASH/RAM breaks down to the following steps:

  1. Configure the memory mapping in linker script.
  2. Using SmartSnippets™ Studio:
    1. Edit ldscripts/mem.ld.h in project’s folder (instructions can be found in file’s header comments).
    2. During project build the mem.ld file will be automatically updated.
  3. Not using SmartSnippets™ Studio:
    1. Edit project’s ldscripts/mem.ld file.
  4. Configure project to compile for execution from FLASH.
  5. In ./sdk/bsp/custom_config_xxx.h header file, set the macros described below as follows and compile normally:
  1. For execution from FLASH (cached):
Code 41 Execution from Flash (cached)
#define dg_configEXEC_MODE                      MODE_IS_CACHED
#define dg_configCODE_LOCATION                  NON_VOLATILE_IS_FLASH
  1. For execution from FLASH (mirrored):
Code 42 Execution from Flash (mirrored)
#define dg_configEXEC_MODE                      MODE_IS_MIRRORED
#define dg_configCODE_LOCATION                  NON_VOLATILE_IS_FLASH
  1. For execution from RAM:
Code 43 Execution from RAM
#define dg_configCODE_LOCATION              NON_VOLATILE_IS_NONE

Note

The BINARY output (<project_name>.bin, NOT the <project_name>.elf) will be used in the next steps.

20.4. Flashing an QSPI image

Using SmartSnippets™ Studio:

Select the folder which includes <project_name>.bin (e.g. the project’s Debug folder) and execute one of the following scripts from SmartSnippets™ Studio external tools menu button.

Table 70 QSPI programming scripts on Windows Host
Script name Notes

Program_qspi_serial_win

(Note 1)

Use this script in case you want to program the selected binary to external QSPI memory using a serial interface. Please follow instructions given on the SmartSnippets™ Studio console window.

Program_qspi_jtag_win

(Note 1)

Use this script in case you want to program the selected binary to external QSPI memory using the JTAG interface.

Note

When calling one of these scripts for the first time you will be prompted to enter configuration options. You may change the selected configuration any time using the program_qspi_config_win script.

Table 71 QSPI programming scripts on Linux Host
Script name Notes

Program_qspi_serial_linux

(Note 1)

Use this script in case you want to program the selected binary to external QSPI memory using a serial interface. Please follow instructions given on the SmartSnippets™ Studio console window.

Program_qspi_jtag_linux

(Note 1)

Use this script in case you want to program the selected binary to external QSPI memory using the JTAG interface.

20.5. Debugging from QSPI

20.5.1. General

The user may use J-Link SWD interface to attach to the running target & debug, OR reset board & debug as follows:

Using SmartSnippets™ Studio :

The SmartSnippets™ DA1468x SDK includes SmartSnippetsTM Studio launch configurations provided with the SmartSnippets™ DA1468x SDK projects (ATTACH for attaching to running target and *_qspi.launch for resetting & attaching to QSPI, RAM for debugging from RAM (where applicable)).

Outside SmartSnippets™ Studio :

The SmartSnippets™ DA1468x SDK includes sample scripts & gdb commands in utilities/scripts/qspi folder:

  • boot_qspi_db* scripts reset board and put a breakpoint in main(). The scripts invoke Jlink gdb server and issue gdb commands
  • gdb_cmd_qspi* files are the gdb command files used by the above scripts

Instructions on using these scripts are provided in the next paragraph.

20.5.2. Debugging with gdb scripts

  1. The scripts include references to the executables:
  • JLinkGDBServerCL
  • arm-none-eabi-gdb

and can be found in the following SmartSnippets™ DA1468x SDK path:

<sdk_root_directory>/utilities/scripts/qspi

  1. Make sure that you have the paths to these executables included in your platform’s system path. If not, edit script files and add the absolute paths to these executables, for instance in boo_qspi_dbg.bat: replace JLinkGDBServerCL.exe with: C:/Program Files/SEGGER/JLink_V512h/JLinkGDBServerCL.exe
  2. Edit the Debug scripts (boot_qspi_dbg.*) and replace PUT_YOUR_APP_ELF_HERE.elf with the name of the .elf file you want to debug. This should be the .elf file of the binary image flashed in the QSPI.
  3. Execute the boot_qspi_dbg.* script.
  4. The J-Link gdb server running must be operational, connected to target, downloading & running the boot loader and CPU halting at main() breakpoint. After this point a “continue” command can be issued and debug process may proceed, using the same gdb server instance.
  5. Alternatively, it is possible to invoke a second instance of J-Link gdb server and attach it to the target.

Note

Since hardware breakpoints are used, only 4 breakpoints are available.